#!/bin/sh
#
# gMaxLinkedd
#
# chkconfig: - 80 20
# processname: gMaxLinked
# config: /etc/gMaxLinked.conf
# pidfile: /var/run/gMaxLinked.pid
# description: Starts and stops the gMaxLinked daemon.

# Source function library.
. /etc/rc.d/init.d/functions

name=gMaxLinked
run=${RUN-/usr/local/sbin/gMaxLinked}
config=${CONFIG-/etc/gMaxLinked.conf}
pidfile=${PDIFILE-/var/run/gMaxLinked.pid}
lockfile=${LOCKFILE-/var/lock/subsys/gMaxLinked}

start() {
    [ -f $config ] || exit 6
    [ -x $exec ] || exit 5
    echo -n $"Starting $name..."
    daemon --pidfile=${pidfile} ${run}
    ret=$?
    echo
    [ $ret -eq 0 ] && touch ${lockfile}
    return $ret
}

stop() {
    echo -n $"Stopping $name..."
    killproc -p ${pidfile} ${name}
    ret=$?
    echo
    [ $ret -eq 0 ] && rm -f ${lockfile} ${pidfile}
    return $ret
}

restart() {
    stop
    start
}

case "$1" in
    start)
	start
        ;;
    stop)
        stop
        ;;
    restart)
	restart
	;;
    *)
	echo $"Usage: $name {start|stop|restart}"
	exit 1
esac

exit $?
